package ymqtt

import (
	"context"
	"time"
)

type device struct {
	sn     string
	time   time.Time
	result *result
	cancel context.CancelFunc
}

func (d *device) start() {
	d.result.start()
}

func (d *device) stop() {
	d.cancel()
}

func newDevice(ctx context.Context, sn string) *device {
	d := &device{
		sn:   sn,
		time: time.Now(),
	}
	ctx, d.cancel = context.WithCancel(ctx)
	d.result = newResult(ctx)
	return d
}
